<!DOCTYPE html>
<html lang="en">

    <head>
        <meta charset="UTF-8" />
        <link rel="stylesheet" href="styles/style.css">
        <link rel="stylesheet" href="styles/theme/atom-one-dark.css">
        <title>例子43-ES6/7常用语法介绍</title>
    </head>

    <body>
        <pre>
            <code>
                // 例子43

                class MyClass {
                    constructor() {
                      // ...
                    }

                    get prop() {
                      return 'getter';
                    }

                    set prop(value) {
                      console.log('setter: ' + value);
                    }
                }

                let inst = new MyClass();
                inst.prop = 123; // setter: 123
                inst.prop; // 'getter'
            </code>
        </pre>
        <script src="scripts/libs/highlight.pack.js"></script>
        <script src="scripts/43.js"></script>
        <script>
            hljs.initHighlightingOnLoad();
        </script>
    </body>

</html>